#include <core/eventloop.h>
#include <core/timestamp.h>
#include <log/logger.h>
#include <nlohmann/json.hpp>
#include <udbus/connection.h>
#include <udbus/types.h>

#include "exampleservice.h"

using namespace ut;

int main(int argc, char **argv)
{
    Logger::category("ut_dev_test");
    EventLoop loop;
    // 注册会话总线
    Connection conn = Connection::SessionBus();
    // 注册服务名
    conn.request_name("com.uniontech.dbus.Example");

    ExampleService service(conn, Path("/com/uniontech/dbus/Exampless"));
    ExampleService services(conn, Path("/com/uniontech/dbus/Examplesssdsd"));
    uDebug("========");
    uDebug() << "09909";

    nlohmann::json json = {
        {"pi", 3.141},
        {"happy", true},
        {"name", "Niels"},
        {"nothing", nullptr},
        {"answer", {{"everything", 42}}},
        {"list", {1, 0, 2}},
        {"object", {{"currency", "USD"}, {"value", 42.99}}}};
    uDebug() << "json:" << json.dump(4);

    uDebug() << "ss:" << to_utc_string(timestamp());

    loop.loop();
    return 0;
}